#include <linux/init.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/stat.h>

MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("bruce.zc_wang");

static int module_single_parm1;
static int module_single_parm2;
static int module_array[20];
static int arr_num=0;

//receive argument: module_single_parm1
module_param(module_single_parm1, int, S_IRUSR);
//receive argument: module_single_parm2
module_param(module_single_parm2, int, S_IRUSR);
//receive mutil argument: stored in array
module_param_array(module_array, int, &arr_num, S_IRUSR);

static int module_param_init(void)
{
	printk(KERN_EMERG "module_param_init\n");
	
	printk(KERN_EMERG "module_single_parm1 = %d\n", module_single_parm1);
	printk(KERN_EMERG "module_single_parm2 = %d\n", module_single_parm2);
	if(arr_num != 0)
	{
		int loop_i = 0;
		for(loop_i; loop_i < arr_num; loop_i++)
		{
			printk(KERN_EMERG "module_array[%d] = %d\n", loop_i, module_array[loop_i]);
		}
	}

	return 0;
}

static void module_param_exit(void)
{
	printk(KERN_EMERG "module_param_exit\n");
}

module_init(module_param_init);
module_exit(module_param_exit);

